from lxml import etree

html = etree.parse('./test.html',etree.HTMLParser())
result = html.xpath("//li[@class='item-0']//text()")
# 当class="li li-first时，并且name="item"
result1 = html.xpath("/li[contains(@class,'li') and @name='item']/a/text()")
result2 = html.xpath("//li[last()-1]/a/text()")
print(result2)
print(result1)
print(result)